<template>
	<z-paging ref="paging" v-model="list" @query="getList" loading-more-default-text="我也是有底线的哦">
		<view class="mainBg h100 container">
			<navbar title="积分明细" />
			<view class="list">
				<view class="col">
		<!-- 			<view class="month">
						4月
					</view>
					<view class="total">
						<text>支出 ￥1000.00</text>
						<text>收入 ￥1000.00</text>
					</view> -->
					<view class="item" v-for="item,index in list" :key="item.id">
						<view class="left">
							<image src="/static/user/balanceList-icon1.png" mode="" v-if="item.beforeScore < item.afterScore"></image>
							<image src="/static/user/balanceList-icon2.png" mode="" v-else></image>
							<view class="text">
								{{item.remark}} <text>{{item.create_time}}</text>
							</view>
						</view>
						<view class="right">
							<view class="btn">
								<text v-if="item.beforeScore > item.afterScore">-</text>
								<text v-else>+</text>
								{{item.score}}
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</z-paging>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				pageNo:1,
				pageSize:10,
			}
		},
		methods: {
			getList() {
				this.$get("/user/scoreList", {
					pageNum: this.pageNo,
					pageSize:this.pageSize,
				}).then(res => {
					//请勿在网络请求回调中给dataList赋值！！只需要调用complete就可以了
					this.$refs.paging.complete(res.data.rows);
				})
			},
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #35CBAD;
	}

	.list {

		.col {
			padding: 10rpx;

			.month {}

			.total {
				font-size: 28rpx;
				color: #666;
				margin-top: 20rpx;

				text {
					margin-right: 40rpx;
				}
			}

			.item {
				display: flex;
				justify-content: space-between;
				border-bottom: 2rpx solid #f7f7f7;
				padding: 40rpx 0;

				&:last-child {
					border: none;
				}

				.left {
					display: flex;

					image {
						width: 52rpx;
						height: 52rpx;
					}

					.text {
						padding-left: 14rpx;

						text {
							display: block;
							font-size: 24rpx;
							color: #999;
						}
					}
				}

				.right {
					font-size: 36rpx;
					font-weight: bold;

					.red {
						color: red;
					}
				}
			}
		}
	}
</style>